<template>
  <div class="order-detail">
    <p class="order">订单信息</p>
    <div class="order-msg">
      <p class="title">
        <span>订单编号：{{ list.ord_num }}</span>
        <span>下单时间：{{ list.time }}</span>
        <span v-if="list.state === 1">付款时间：{{ list.time }}</span>
        <span class="print" @click="printing">打印订单</span>
      </p>
      <table>
        <tr>
          <th>包裹</th>
          <th>商品</th>
          <th>单价(元)*数量(个)</th>
          <th>商品总价(元)</th>
          <th>优惠</th>
        </tr>
        <tbody>
          <tr>
            <td></td>
            <td>{{ list.game }}</td>
            <td>{{ list.price }}*{{ list.num }}</td>
            <td>{{ list.price * list.num }}</td>
            <td></td>
          </tr>
          <tr>
            <td class="money" colspan="5">
              <p><span>商品金额：</span><span class="tips">{{ list.price * list.num }}元</span></p>
              <p><span>优惠金额：</span><span class="tips">-{{ list.num }}元</span></p>
              <p><span>实收金额：</span><span class="tips">{{ list.price }}元</span></p>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</template>

<script>
export default {
  props: ["list"],
  methods: {
    printing() {
      this.$router.push({
        name: "order_printing",
        query: {
          id: this.id,
        },
      });
    },
  },
};
</script>

<style scoped>
.order-detail {
  width: 95%;
  margin: 20px auto;
  border: 1px solid lightgray;
  padding: 20px;
  box-sizing: border-box;
}
.order {
  width: 100%;
  padding-bottom: 20px;
  border-bottom: 1px solid gray;
  font-size: 16px;
  font-weight: bold;
  color: #666;
}
.order-msg {
  margin: 20px 0;
}
.print {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 10px;
  color: gray;
  cursor: pointer;
  background: #eee;
}
.title span {
  margin-right: 20px;
  font-size: 12px;
}
table {
  width: 100%;
  border: 1px solid lightgray;
  border-collapse: collapse;
  margin: 20px 0;
}
th,
td {
  border: 1px solid lightgray;
  text-align: center;
  line-height: 30px;
}
.money p{
  text-align: right;
  margin-right: 24px;
}
.money .tips{
  width: 48px;
  display: inline-block;
}
</style>
